package lbframework.gui;

import lbframework.bean.dialog.LBDialog;
import lbframework.classe.Util;

public class MensagemErroGUI extends LBDialog {

    public MensagemErroGUI(String detalhe) throws Exception {
        initComponents();

        centralizarForm();

        txtDetalhe.setText(detalhe);
        this.setModal(true);

        txtDetalhe.setCaretPosition(0);
        
        setVisible(true);


    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        scpDetalhe = new javax.swing.JScrollPane();
        txtDetalhe = new lbframework.bean.textArea.LBTextArea();
        btnSair = new lbframework.bean.button.LBButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Detalhes");

        txtDetalhe.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
        txtDetalhe.setEditable(false);
        txtDetalhe.setLineWrap(false);
        txtDetalhe.setRows(5);
        txtDetalhe.setWrapStyleWord(false);
        txtDetalhe.setCaixaAlta(false);
        txtDetalhe.setMascara("");
        scpDetalhe.setViewportView(txtDetalhe);

        btnSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/lbframework/img/sair.png"))); // NOI18N
        btnSair.setText("Sair");
        btnSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSairActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(scpDetalhe, javax.swing.GroupLayout.DEFAULT_SIZE, 553, Short.MAX_VALUE)
                    .addComponent(btnSair, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(scpDetalhe, javax.swing.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnSair, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed
        try {
            sair();
        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }
    }//GEN-LAST:event_btnSairActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private lbframework.bean.button.LBButton btnSair;
    private javax.swing.JScrollPane scpDetalhe;
    private lbframework.bean.textArea.LBTextArea txtDetalhe;
    // End of variables declaration//GEN-END:variables
}
